<?php declare(strict_types=1);


namespace Database\Migration;


use Swoft\Db\Schema\Blueprint;
use Swoft\Devtool\Annotation\Mapping\Migration;
use Swoft\Devtool\Migration\Migration as BaseMigration;

/**
 * Class AddFiledsInTenant
 *
 * @since 2.0
 *
 * @Migration(time=20200825133705)
 */
class AddFiledsInTenant extends BaseMigration
{
    /**
     * @return void
     * @throws \ReflectionException
     * @throws \Swoft\Bean\Exception\ContainerException
     * @throws \Swoft\Db\Exception\DbException
     */
    public function up(): void
    {
        //admin添加tenant字段
        $this->schema->table('tenant', function (Blueprint $blueprint){
            $blueprint->string('platform_name', 64)->after('name')->comment('平台名称');
            $blueprint->string('logo', 32)->after('platform_name')->comment('公司logo');
            $blueprint->string('account', 64)->after('logo')->comment('账号');
            $blueprint->string('credit_code', 64)->after('account')->comment('统一信用代码');
            $blueprint->string('credit', 64)->after('credit_code')->comment('营业执照图片');
            $blueprint->string('tax_authority', 64)->after('credit')->comment('登记机关');
            $blueprint->string('legal_name', 64)->after('tax_authority')->comment('法人姓名');
            $blueprint->string('legal_code', 32)->after('legal_name')->comment('法人身份证号');
            $blueprint->string('address', 64)->after('legal_code')->comment('通信地址');
            $blueprint->string('contact_name', 64)->after('address')->comment('联系人姓名');
            $blueprint->string('contact_phone', 64)->after('contact_name')->comment('联系人联系方式');
            $blueprint->string('id_card_face', 64)->after('contact_phone')->comment('身份证正面照');
            $blueprint->string('id_card_back', 64)->after('id_card_face')->comment('身份证反面照片');
            $blueprint->string('app_id', 32)->after('id_card_back')->comment('app_id,做sass开放账号');
            $blueprint->string('app_secret', 32)->after('app_id')->comment('app_secret,做sass开放秘钥');
            $blueprint->string('app_check', 32)->after('app_secret')->comment('app_check,做sass开放验证');
        });
    }

    /**
     * @return void
     */
    public function down(): void
    {
        //todo 这里暂时先不写
    }
}
